Event Object Attributes¶
When a rule is triggered, the function is provided the event instance that triggered it.
The specific data depends on the event type.
For example, the event
object returned by the ItemStateChangedEvent event type has itemName
, itemState
, and oldItemState
attributes. The StartupTrigger
and GenericCronTrigger
do not provide any event
objects.
Rather than digging through the code to look up the attributes available in a particular event
object, you can add a log entry inside the function and then trigger the rule (View the names of an object’s attributes).
Here is a table of the attributes available in event
objects (or inputs['event']
, if using raw API or extensions), including a comparison to the Rules DSL implicit variables:
Rules DSL Equivalent |
Scripted Automation |
@when Trigger(s) |
Event Object(s) |
Description |
---|---|---|---|---|
|
|
“received update”
“changed”
“received command”
|
Name of Item that triggered event (String)
|
|
|
|
“changed”
|
Name of member that caused the state
change of a parent Group (String)
|
|
|
|
“received update”
“changed”
|
State of item that triggered event (State)
|
|
|
|
“changed”
|
Previous state of Item or Group that
triggered event (State)
|
|
|
|
“received command”
|
Command that triggered event (Command)
|
|
N/A
|
|
Not currently supported
|
State that the Item triggering the event
is predicted to have (State)
|
|
N/A
|
|
Not currently supported
|
If
true then it basically only confirmsthe previous item state because a received
command will not be successfully executed
and therefore presumably will not result in
a state change (e.g. because no handler
currently is capable of delivering such an
event to its device) (Boolean)
|
|
N/A
|
|
Not currently supported
|
State of Group that triggered event (State)
|
|
N/A
|
|
Not currently supported
|
Item that triggered event (Item)
|
|
N/A
|
|
Not currently supported
|
Item DTO prior to the Item being updated
(Item)
|
|
N/A
|
|
“triggered”
|
Channel associated with Event that
triggered event (Channel)
|
|
N/A
|
|
“triggered”
|
Event that triggered event (Event)
|
|
N/A
|
|
Not currently supported
|
Thing that triggered event (Thing)
|
|
N/A
|
|
Not currently supported
|
Thing DTO prior to the Thing being updated
(Thing)
|
|
N/A
|
|
“changed”
|
ThingUID of Thing that triggered event
(ThingUID)
|
|
N/A
|
|
“changed”
|
ThingStatusInfo of Thing that triggered
event (ThingStatusInfo)
|
|
N/A
|
|
“changed”
|
Previous ThingStatusInfo of Thing that
triggered event (ThingStatusInfo)
|